/**
 * 员工区域分布视图
 */

Ext.define("app.view.staff.Area",{
	extend:'Ext.chart.Chart',
	alias:'widget.staffarea',
	store:'AreaStore',
	//store:store,
	renderTo: Ext.getBody(),
    width: 500,
    height: 350,
    animate: true,
    //store: store,
    theme: 'Base:gradients',
    series: [{
        type: 'pie',
        angleField: 'count',
        showInLegend: true,
        tips: {
            trackMouse: true,
            width: 140,
            height: 28,
            renderer: function(sprite, config) {
            	
                // calculate and display percentage on hover
            	var store = sprite.store;//获得所在store
            	//console.log(store);
            	//console.log(sprite.getProxy());
                var total = 0;
                store.each(function(rec) {
                    total += rec.get('count');
                });
                this.setTitle(sprite.get('area') + ': '+sprite.get('count') +' 占比:'+ Math.round(sprite.get('count') / total * 100) + '%');
            }
        },
        highlight: {
            segment: {
                margin: 20
            }
        },
        label: {
            field: 'area',
            display: 'rotate',
            contrast: true,
            font: '18px Arial'
        }
    }]
});